package com.powernode.commons;

import lombok.Data;

import java.lang.reflect.Member;

@Data
public class Result {

    private int code;

    private String msg;

    private Object data;


    public Result(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result() {
    }

    /**
     * 传入参数
     */


    public static Result OK(){
        return new Result(200, "success");
    }

    public static Result OK(Object data){
        return new Result(200, "success",data);
    }

    /**
     * 业务失败方法
     */
    public static Result build(ResultException e){
        return new Result(e.getCode(),e.getMsg());
    }



}
